package com.habdqn.studentmanager.util;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import org.apache.log4j.Logger;

/**
 * 配置文件读取
 *
 */
public class ConfigUtil {

	private static Properties prop = new Properties();

	private static Logger logger = Logger.getLogger(ConfigUtil.class);

	static {
		try (InputStream is = ConfigUtil.class.getClassLoader().getResourceAsStream("config.properties")) {
			if (null != is) {
				prop.load(is);
			}
		} catch (IOException e) {
			logger.error(e);
		}
	}

	/**
	 * 已String的方式获取配置中的值
	 * 
	 * @param key
	 * @return
	 */
	public static String getKey(String key) {
		return prop.getProperty(key);
	}
}
